<template>
    <view class="body">
        <view class="topcontent">
            <u-navbar :border-bottom="false" title="我的订单" title-color="#000"></u-navbar>
        </view>
        <view class="top-tab">
            <u-subsection active-class="act" :list="listTop" :currentTop="currentTop" @change="sectionChange">
            </u-subsection>
        </view>
        <view class="tabs">
            <u-tabs :list="list" :is-scroll="false" :current="current" active-color="#333333" inactive-color="#B8B8B8"
                    @change="change" @scrolltolower="scroll"></u-tabs>
        </view>
        <scroll-view class="container" scroll-y="true" @scrolltolower="scroll" :scroll-with-animation="true"
                     :enable-back-to-top="true">
            <view class="orderInformation" v-for="(item, i) in goodsList" :key="i">
                <!-- 藏品 -->
                <view class="orderCommodity" @click="toPage(item)" v-if="item.goods &&menu==0">
                    <u-image width="148rpx" height="148rpx" :src="item.goods.image"></u-image>
                    <view class="orderTitle">
                        <view>{{ item.goods.title }}</view>
                        <view>
                            <text><text style="font-size: 24rpx;">￥</text>{{ item.pay_price }}</text>
                        </view>
                    </view>
                    <!-- <view class="sratus paid">{{item.order_status_text}}</view> -->
                    <view v-if="item.order_status == -1" class="sratus close">已取消</view>
                    <view v-else-if="item.order_status == 0" class="sratus paid">待付款</view>
                    <view v-else-if="item.order_status == 1" class="sratus paid">交易中</view>
                    <view v-else-if="item.order_status == 2" class="sratus finish">已完成</view>
                </view>
                <!-- 盲盒 -->
                <view class="orderCommodity" @click="toPage(item)" v-if="menu==1">
                    <u-image width="148rpx" height="148rpx" :src="item.image"></u-image>
                    <view class="orderTitle">
                        <view>{{ item.name }}</view>
                        <view>
                            <text><text style="font-size: 24rpx;">￥</text>{{ item.price }}</text>
                        </view>
                    </view>
                    <view v-if="item.order_status == -1" class="sratus close">已取消</view>
                    <view v-else-if="item.order_status == 0" class="sratus paid">待付款</view>
                    <view v-else-if="item.order_status == 1" class="sratus paid">交易中</view>
                    <view v-else-if="item.order_status == 2" class="sratus finish">已完成</view>
                    <!-- <view class="sratus paid">{{item.order_status}}</view>
                    <view class="sratus paid">{{item.order_status}}</view> -->
                </view>


                <view class="price">
                    <text v-if="menu==0">下单时间：{{ $u.timeFormat(item.created_at, 'yyyy-mm-dd hh:MM:ss') }}</text>
                    <text v-else-if="menu==1">下单时间：{{ $u.timeFormat(item.add_time, 'yyyy-mm-dd hh:MM:ss') }}</text>
                </view>

                <view class="shipments" v-if="item.order_status == 0">
                    <!-- <u-button v-if="item.order_status == 0 && menu == 0" class="cancel-btn" @click="cancelOrder(item)">取消
                    </u-button> -->

                    <u-button v-if="item.order_status == 0 && menu == 0" class="submit-btn"
                              @click="payTabs(item.order_no)">去支付</u-button>

                    <u-button v-if="item.order_status == 0 && menu == 1" class="cancel-btn" @click="cancelOrder(item)">
                        取消</u-button>
                    <u-button v-if="item.order_status == 0 && menu == 1" class="submit-btn"
                              @click="payTabs(item.order_no)">立即支付</u-button>
                </view>
                <view class="shipments" style="justify-content: right;" v-if="item.order_status == 2">
                    <u-button v-if="item.order_status == 2 && menu == 1" class="submit-btn" @click="lookCard(item)">查看藏品
                    </u-button>
                    <u-button class="submit-btn" v-if="item.is_bill != 1" @click="applyBill(item.id, menu == 0 ? 1 : 2)">申请发票</u-button>
                </view>
            </view>
            <view class="box6" v-if="goodsList.length==0">
                <image src="/static/home/03.png" mode="" class="meiyou"></image>
                <view class="qing">
                    暂无数据
                </view>
            </view>
            <!-- <u-empty text="暂无订单" mode="list" v-if="goodsList.length == 0"></u-empty> -->
            <u-loadmore v-if="goodsList.length > 3" :status="status" :icon-type="iconType" :load-text="loadText"
                        style="paddingbottom: 20rpx" />
        </scroll-view>
        <!-- 取消订单 -->
        <u-modal v-model="orderShow" content="确定要取消订单吗？" :show-cancel-button="true" @confirm="confirmOrder"></u-modal>
        <u-modal v-model="receiptShow" content="确定收到货了吗？" :show-cancel-button="true" @confirm="receiptOrder"></u-modal>
        <!-- 申请售后 -->
        <!-- <sales v-model="salesStatus" :orderGoods="orderGoods" @cancelSales="cancelSales" @sureSales="sureSales"></sales>
    <logistics v-model="logisticsStatus"></logistics> -->
        <!-- 支付方式 -->
        <!-- <pay v-model="payStatus" ref="pay" @paymanner="paymanner"></pay> -->
        <!-- <pay v-model="payStatus" ref="pay" @paymanner="paymanner"></pay> -->
        <!-- <pay v-if="payStatus" payStatus="payStatus" ref="pay" @paymanner="paymanner" @input="cancl"></pay> -->


        <u-popup v-model="open_mh" mode="center" :mask-close-able="false" border-radius="30">
            <view class="popup2">
                <view class="donghua animated zoomInUp">
                    <image :src="look_item.from_image" mode=""></image>
                    <view class="po_title">
                        获得-{{look_item.from_name}}
                    </view>
                    <text class="po_hint">可在藏品中查看此藏品</text>
                    <u-button class="po_btn" @click="open_mh =false">确定</u-button>
                </view>
            </view>
        </u-popup>
        <pay v-if="payStatus" :payStatus="payStatus" ref="pay" @paymanner="paymanner" @input="cancl"></pay>
        <!-- 密码 -->
        <!-- <password v-model="passStatus" @password="setPassword" @input="cancl1"></password> -->
        <password v-if="passStatus" :passStatus="passStatus" @password="setPassword" @input="cancl1"></password>
        <tzs-loading v-model="loading"></tzs-loading>
    </view>
</template>
<script>
    import myOrder from './myOrder.js';
    export default myOrder;
</script>
<style lang="scss" scoped>
    @import './myOrder.scss';
</style>
